package xyz.yolin.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xyz.yolin.mapper.AdminMapper;
import xyz.yolin.pojo.Admin;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//将用户用户表中id和account绑定，然后渲染到list页面
//@Component
public class SystemInit {
    @Autowired
    private AdminMapper adminMapper;
    public static Map<Integer,Admin> adminMap=new HashMap<Integer, Admin>();

//    @PostConstruct
    public void init(){
        System.out.println("初始化");
        List<Admin> list = adminMapper.query(null);
        for (Admin admin:list){
            adminMap.put(admin.getId(),admin);
        }
        System.out.println("初始化加载数据admin"+adminMap);
    }
}
